package com.thirdgroup.service.impl;

import com.thirdgroup.dao.OrderPhoneDao;
import com.thirdgroup.dao.OrderPhoneSonDao;
import com.thirdgroup.dao.impl.OrderPhoneSonDaomImpl;
import com.thirdgroup.dao.impl.OrderPhoneDaoImpl;
import com.thirdgroup.pojo.vo.OrderDetailsVO;
import com.thirdgroup.pojo.vo.OrderPhoneVo;
import com.thirdgroup.service.OrderPhoneService;
import com.thirdgroup.utils.respond.R;

import java.util.List;

public class OrderPhoneServiceImpl implements OrderPhoneService {
    private OrderPhoneDao orderPhoneDao=new OrderPhoneDaoImpl();
    private OrderPhoneSonDao orderPhoneSonDao=new OrderPhoneSonDaomImpl();
    @Override
    public R orderPhone(String order) {
        OrderDetailsVO select = orderPhoneDao.select(order);
        List<OrderPhoneVo> selects = orderPhoneSonDao.selects(order);
        if (select != null &&!"".equals(select)){
            if (selects!=null &&!"".equals(selects)){
                select.setOrderPhoneVos(selects);
            }
            return R.ok(select);
        }
        System.out.println("系统繁忙，请稍后再试~");
        return R.error(500,"系统繁忙，请稍后再试~");
    }
}
